package com.wangyg.breadstore.configuration;

import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

/**
 * Created by wangyg6 on 2019/5/15.
 * @bean中不加描述，则bean名字为方法名，比如getHolder。
 */
@Configuration
public class CreateRestTemplate {
	@Bean("loadBalanceRestTemplate")
	@LoadBalanced
	public RestTemplate getLoadBalanceRestTemplate() {
		return new RestTemplate();
	}
	@Bean("restTemplate")
	public RestTemplate getRestTemplate() {
		return new RestTemplate();
	}
	@Bean
	public ApplicationContextHolder getHolder() {
		return new ApplicationContextHolder();
	}

}
